home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / TextConverter.rtf,v < prev    next >
Text File  |  1995-06-12  |  6KB  |  259 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.1;
  5. locks    death:1.2;
  6. comment  @@;
  7.  
  8.  
  9. 1.2
  10. date     93.04.04.23.45.24;  author death;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     93.01.10.15.08.53;  author death;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Sun Apr  4 23:45:23 PDT 1993
  27. @
  28. text
  29. @{\rtf0\ansi{\fonttbl\f1\fnil Palatino-Roman;\f2\ftech Symbol;\f3\fnil Times-Roman;\f0\fnil NewCenturySchlbk-Roman;}
  30. \paperw14520
  31. \paperh11920
  32. \margl120
  33. \margr0
  34. \pard\tx5700\tx11360\f1\b0\i0\ul0\fs24 $Revision: 1.1 $    $Author: death $    $Date: 93/01/10 15:08:53 $\
  35.  
  36. \pard \
  37.  
  38. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  39.  
  40. \fs28 \
  41.  
  42. \fs16 \
  43.  
  44. \fs28 \
  45.  
  46. \fs16 \
  47.  
  48. \pard\b\li1100 \
  49. \
  50. \
  51. \
  52.  
  53. \fs36 TextConverter\
  54.  
  55. \fs16 \
  56.  
  57. \pard\tx7140\b0\fs28\li2100 INHERITS FROM    ResultObject\
  58.  
  59. \fs16 \
  60.  
  61. \fs28 DECLARED IN    TextConverter.h\
  62.  
  63. \fs16 \
  64. \
  65. \
  66.  
  67. \fs28 CLASS DESCRIPTION\
  68.  
  69. \fs16 \
  70.  
  71. \pard\tx3120\tx3620\tx4120\fs28\li2620 The TextConverter class serves as a base class for new classes.  It provides little functionality on its own.  Classes decended from TextConverter will convert text from one character set to another.  For instance, a subclass might convert text from a Macintosh file to equivalent text for a NeXT application.  The TextConverter class, itself, merely takes Characters, and returns them to the caller unaltered.\
  72.  
  73. \fs16 \
  74.  
  75. \fs28 There are two primarly methods provided by TextConverter, and they should be overridden by all subclasses.  
  76. \i ConvertCharacter:
  77. \i0  takes a single character, and returns an equivalent character in the destination character set (e.g. if it is passed a Mac 0xA5 (bullet) character, it might return the character 0xB7 (a bullet in the NeXT character set)).  If the character can not be mapped to a single character, then the subclass is free to choose whether to leave the value unchanged, or make an approximation.  The second method, 
  78. \i ConvertString:WithLength:
  79. \i0  also converts from one character set to another.  Unlike 
  80. \i ConvertCharacter:
  81. \i0 , it allows for converting a single character to multiple (e.g. a greater than or equal sign in one character set might be mapped to the pair of characters `>=').\
  82.  
  83. \fs16 \
  84.  
  85. \fs28 This class does not have specialized 
  86. \i init
  87. \i0  or 
  88. \i free
  89. \i0  methods. The inherited ones work adequately.  Note that this class is essentially just a pair of functions bundled up as a fancy class! =)\
  90. \
  91.  
  92. \fs16 \
  93.  
  94. \pard\tx7140\li2100 \
  95. \
  96.  
  97. \fs28 INSTANCE VARIABLES\
  98.  
  99. \fs16 \
  100.  
  101. \pard\tx7140\tx10180\tx10680\i\fs28\fi-4540\li7140 Declared in TextConverter
  102. \i0     none\
  103.  
  104. \pard\tx7140\fs16\li2100 \
  105. \
  106. \
  107.  
  108. \fs28 METHOD TYPES\
  109.  
  110. \fs16 \
  111.  
  112. \pard\tx7140\tx10180\tx10680\fs28\fi-4540\li7140 Converting characters    
  113. \f2 - 
  114. \f1 ConvertCharacter:\
  115.  
  116. \pard\tx10180\tx10680\f2\fi-520\li7660 - 
  117. \f3 ConvertString:WithLength:
  118. \f2 \
  119.  
  120. \pard\tx7140\f1\fs16\li2100 \
  121. \
  122. \
  123.  
  124. \fs28 CLASS METHODS\
  125.  
  126. \fs16 \
  127.  
  128. \b \
  129.  
  130. \b0\fs28 None\
  131.  
  132. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  133.  
  134. \pard\tx7140\li2100 \
  135. \
  136.  
  137. \fs28 INSTANCE METHODS\
  138.  
  139. \fs16 \
  140.  
  141. \b \
  142.  
  143. \fs28 ConvertCharacter:\
  144.  
  145. \pard\b0\fi-1020\li3620 - (Character) 
  146. \b ConvertCharacter: 
  147. \b0 (Character) 
  148. \i theCharacter\
  149.  
  150. \pard\tx3620\i0\fi-380\li3620 0    Result codes and test\
  151. 1    The returned character
  152. \fs16 \
  153.  
  154. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b\fi-1020\li3620 \
  155.  
  156. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This returns a single character in the destination character set that most closely matches the character value that it is provided.  In this TextConverter class, this method merely returns the value it was passed.\
  157.  
  158. \pard\tx7140\fs16\li2100 \
  159.  
  160. \b \
  161.  
  162. \fs28 ConvertString:WithLength:\
  163.  
  164. \pard\f2\b0\fi-1020\li3620 - 
  165. \f1 (Pointer) 
  166. \b ConvertString:
  167. \b0  (Pointer) 
  168. \i theData 
  169. \b\i0 WithLength
  170. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fi-1020\li3620 :
  171. \b0  (
  172. \pard\fi-1020\li3620 Integer
  173. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fi-1020\li3620 ) 
  174. \pard\i\fi-1020\li3620 length
  175. \b\i0 \
  176.  
  177. \pard\tx3620\b0\fi-380\li3620 0    Result codes and test\
  178. 1    The returned Pointer\
  179. 2    The lenght of the returning data
  180. \fs16 \
  181.  
  182. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b\fi-1020\li3620 \
  183.  
  184. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 This method takes a pointer to a string of 
  185. \i length
  186. \i0  characters (
  187. \i length
  188. \i0  should be a character count, not a byte count, should the two ever be different).  Like 
  189. \b ConvertCharacter:
  190. \b0 , this will convert characters in the source data, which are assumed to be in one character set, into characters in its destination character set.  The TextConverter class merely maps each incomming character to an identical outgoing character. There are two things to note in particular about this method.  This method allows for mapping multiple source characters to single destination characters, or single source to multiple destination characters.  Because of this, it can not directly modify the source string.  Consequently, it always allocates a new block of memory, and converts into it. A pointer to this new block is returned, along with the length of the converted data.  This data can later be deallocated with FreePointer().  \
  191.  
  192. \fs16 \
  193.  
  194. \pard\tx7140\b\li2100 \
  195.  
  196. \b0 \
  197.  
  198. \fs28 BUGS AND PROBLEMS\
  199.  
  200. \fs16 \
  201.  
  202. \pard\tx3120\tx3620\tx4120\fs28\li2620 none yet\
  203.  
  204. \fs16 \
  205.  
  206. \pard\tx7140\li2100 \
  207. \
  208.  
  209. \fs28 ENHANCEMENT IDEAS\
  210.  
  211. \fs16 \
  212.  
  213. \pard\tx3120\tx3620\tx4120\fs28\li2620 none\
  214.  
  215. \fs16 \
  216.  
  217. \pard\tx7140\li2100 \
  218. \
  219.  
  220. \fs28 CONSTANT, DEFINED TYPES AND ERROR CODES\
  221.  
  222. \fs16 \
  223.  
  224. \pard\tx6480\tx7180\fs24\fi-3860\li6480 \
  225. #define errCANTMAPTOONE    1001    /* set by ConvertChar: if mapping would be > 1 dest char */\
  226. #define errCANTMAPFROMONE    1002    /* set by ConvertChar: if mapping needs > 1 source char */\
  227.  
  228. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  229.  
  230. \pard\tx7140\li2100 \
  231. \
  232.  
  233. \fs28 MODIFICATION HISTORY\
  234.  
  235. \fs16 \
  236.  
  237. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    TextConverter.rtf,v $
  238. Revision 1.1  93/01/10  15:08:53  death
  239. Sun Jan 10 15:08:53 PST 1993
  240.  
  241. \fi-20\li3120 \
  242.  
  243. }
  244. @
  245.  
  246.  
  247. 1.1
  248. log
  249. @Sun Jan 10 15:08:53 PST 1993
  250. @
  251. text
  252. @d6 1
  253. a6 1
  254. \pard\tx5700\tx11360\f1\b0\i0\ul0\fs24 $Revision: 1.2 $    $Author: death $    $Date: 92/04/05 22:52:03 $\
  255. d209 4
  256. a212 1
  257. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    $
  258. @
  259.